//
// Created on 2024/11/14.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
// please include "napi/native_api.h".

#include "capi_drag_dragaction_test.h"
#include "common/common.h"
#include <arkui/drag_and_drop.h>
#include <arkui/native_interface.h>
#include <string>
#include <sstream>

namespace ArkUICApiDemo {

static void SetNodeWidthAndHeight(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode, float width, float height)
{
    ArkUI_NumberValue width_value[] = {{.f32 = width}};
    ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(rootNode, NODE_WIDTH, &width_item);
    ArkUI_NumberValue height_value[] = {{.f32 = height}};
    ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(rootNode, NODE_HEIGHT, &height_item);
}

static auto createDragChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeType type, bool dragable = true, std::string lableStr = "")
{
    // 拖拽节点
    auto childNode = nodeAPI->createNode(type);
    ArkUI_AttributeItem lableItem = {.string = lableStr.c_str()};
    nodeAPI->setAttribute(childNode, NODE_BUTTON_LABEL, &lableItem);
    ArkUI_NumberValue border_value[] = {{.f32 = PARAM_1}};
    ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(childNode, NODE_BORDER_WIDTH, &border_item);
    OH_ArkUI_SetNodeDraggable(childNode, dragable);
    return childNode;
}

static auto createDragAreaNode(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeType type, std::string areaText = "")
{
    // 拖拽区域
    auto dragArea = nodeAPI->createNode(type);
    auto dragText = nodeAPI->createNode(ARKUI_NODE_TEXT);
    ArkUI_AttributeItem dragTextItem = {.string = areaText.c_str()};
    nodeAPI->setAttribute(dragText, NODE_TEXT_CONTENT, &dragTextItem);
    ArkUI_NumberValue border_value[] = {{.f32 = PARAM_2}};
    ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(dragArea, NODE_BORDER_WIDTH, &border_item);
    nodeAPI->registerNodeEvent(dragArea, NODE_ON_DROP, 1, nullptr);
    nodeAPI->addChild(dragArea, dragText);
    return dragArea;
}

static std::vector<OH_PixelmapNative *> createPixelmap()
{
    // 设置pixelMap
    uint8_t data[960000];
    size_t dataSize = 960000;
    for (int i = 0; i < dataSize; i++) {
        data[i] = i + 1;
    }
    // 创建参数结构体实例，并设置参数
    OH_Pixelmap_InitializationOptions *createOpts;
    OH_PixelmapInitializationOptions_Create(&createOpts);
    OH_PixelmapInitializationOptions_SetWidth(createOpts, 100);
    OH_PixelmapInitializationOptions_SetHeight(createOpts, 200);
    OH_PixelmapInitializationOptions_SetPixelFormat(createOpts, PIXEL_FORMAT_BGRA_8888);
    OH_PixelmapInitializationOptions_SetAlphaType(createOpts, PIXELMAP_ALPHA_TYPE_UNKNOWN);
    // 创建Pixelmap实例
    OH_PixelmapNative *pixelmap = nullptr;
    OH_PixelmapNative_CreatePixelmap(data, dataSize, createOpts, &pixelmap);
    OH_PixelmapNative_Rotate(pixelmap, 90.0);
    OH_PixelmapNative_Opacity(pixelmap, 0.2);
    OH_PixelmapNative_Scale(pixelmap, 0.8, 1.0);
    OH_PixelmapNative_Flip(pixelmap, true, true);
    std::vector<OH_PixelmapNative *> pixelVector;
    pixelVector.push_back(pixelmap);
    return pixelVector;
}

static OH_UdmfData* createUnifiedData()
{
    // 设置unifiedData
    OH_UdmfRecord *record = OH_UdmfRecord_Create();
    OH_UdsPlainText *plainText = OH_UdsPlainText_Create();
    int returnStatus;
    OH_UdsPlainText_SetAbstract(plainText, "this is plainText Abstract example");
    OH_UdsPlainText_SetContent(plainText, "this is plainText Content example");
    returnStatus = OH_UdmfRecord_AddPlainText(record, plainText);
    OH_UdmfData *data = OH_UdmfData_Create();
    OH_UdmfData_AddRecord(data, record);
    return data;
}

namespace DragDragaction {
static int TEST_NUM = 0;
static double forcedNumber[] = {-1, 0, 1, 5, 2147483647, 2147483648, 200.66};
static float xNumber[] = {-1, 0, 100};
static float yNumber[] = {-1, 0, 100};
static int32_t pointer[] = {-1, 0, 10};
static int indexA = 0;
static int indexB = 0;
static int indexC = 0;
ArkUI_NodeHandle textLog = nullptr;
ArkUI_NodeHandle returnLog = nullptr;
std::string logstr = "";
static void OnEventReceive(ArkUI_NodeEvent *event)
{
    OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CapiDragDragaction", "OnEventReceive");
    if (event == nullptr) {
        OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CapiDragDragaction", "OnEventReceive: event is null");
        return;
    }
    ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr;
    OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI);
	auto targetId = OH_ArkUI_NodeEvent_GetTargetId(event);

	ArkUI_NodeHandle node = OH_ArkUI_NodeEvent_GetNodeHandle(event);

    auto pixelVector = createPixelmap();
    auto data = createUnifiedData();

    if (targetId == ON_TOUCH_INTERCEPT || targetId == ON_DROP) {
        if (TEST_NUM == 10) {
            auto btDragAction = OH_ArkUI_CreateDragActionWithNode(node);
            std::stringstream ss;
            ss << "log:\n";
            ss << "OH_ArkUI_CreateDragActionWithNode = " << static_cast<void*>(btDragAction);
            // 设置pixelMap
            OH_ArkUI_DragAction_SetPixelMaps(btDragAction, pixelVector.data(), pixelVector.size());
            auto dragPreviewOption = OH_ArkUI_CreateDragPreviewOption();
            OH_ArkUI_DragPreviewOption_SetDefaultShadowEnabled(dragPreviewOption, true);
            OH_ArkUI_DragPreviewOption_SetDefaultRadiusEnabled(dragPreviewOption, true);
            OH_ArkUI_DragPreviewOption_SetScaleMode(dragPreviewOption, ARKUI_DRAG_PREVIEW_SCALE_DISABLED);
            OH_ArkUI_DragAction_SetDragPreviewOption(btDragAction, dragPreviewOption);
            auto ret = OH_ArkUI_StartDrag(btDragAction);
            ss << "\nOH_ArkUI_StartDrag = " << std::to_string(ret);
            std::string logstr = ss.str();
            ArkUI_AttributeItem dragTextItem = {.string = logstr.c_str()};
            nodeAPI->setAttribute(returnLog, NODE_TEXT_CONTENT, &dragTextItem);
            OH_ArkUI_DragAction_Dispose(btDragAction);
        }
        if (TEST_NUM == 20) {
            auto btDragAction = OH_ArkUI_CreateDragActionWithNode(node);
            // 设置pixelMap
            OH_ArkUI_DragAction_SetPixelMaps(btDragAction, pixelVector.data(), pixelVector.size());
            OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CapiDragDragaction", "OnEventReceive index = %{public}d", indexA);
            std::stringstream ss;
            auto ret = OH_ArkUI_DragAction_SetPointerId(btDragAction, pointer[indexA]);
            ss << "\nOH_ArkUI_DragAction_SetPointerId = " << std::to_string(indexA) << " = "<< std::to_string(ret);
            if (indexA++ >= 2){
                indexA = 0;
            }
            std::string logstr = ss.str();
            ArkUI_AttributeItem dragTextItem = {.string = logstr.c_str()};
            nodeAPI->setAttribute(returnLog, NODE_TEXT_CONTENT, &dragTextItem);
            OH_ArkUI_StartDrag(btDragAction);
            OH_ArkUI_DragAction_Dispose(btDragAction);
        }
        if (TEST_NUM == 30) {
            auto btDragAction = OH_ArkUI_CreateDragActionWithNode(node);
            // 设置pixelMap
            OH_ArkUI_DragAction_SetPixelMaps(btDragAction, pixelVector.data(), pixelVector.size());
            OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CapiDragDragaction", "OnEventReceive index = %{public}d", indexB);
            std::stringstream ss;
            auto ret = OH_ArkUI_DragAction_SetTouchPointX(btDragAction, xNumber[indexB]);
            ss << "\nOH_ArkUI_DragAction_SetTouchPointX = " << std::to_string(ret);
            ret = OH_ArkUI_DragAction_SetTouchPointY(btDragAction, yNumber[indexB]);
            ss << "\nOH_ArkUI_DragAction_SetTouchPointY = " << std::to_string(ret);
            std::string logstr = ss.str();
            ArkUI_AttributeItem dragTextItem = {.string = logstr.c_str()};
            nodeAPI->setAttribute(returnLog, NODE_TEXT_CONTENT, &dragTextItem);
            if (indexB++ >= 2){
                indexB = 0;
            }
            OH_ArkUI_StartDrag(btDragAction);
            OH_ArkUI_DragAction_Dispose(btDragAction);
        }
        if (TEST_NUM == 40) {
            auto btDragAction = OH_ArkUI_CreateDragActionWithNode(node);
            // 设置pixelMap
            OH_ArkUI_DragAction_SetPixelMaps(btDragAction, pixelVector.data(), pixelVector.size());
            int returnValue = OH_ArkUI_DragAction_SetData(btDragAction, data);
            std::string returnStr = "OH_ArkUI_DragAction_SetData: ";
            returnStr += std::to_string(returnValue);
            ArkUI_AttributeItem dragTextItem = {.string = returnStr.c_str()};
            nodeAPI->setAttribute(returnLog, NODE_TEXT_CONTENT, &dragTextItem);
            OH_ArkUI_DragAction_RegisterStatusListener(btDragAction, nullptr,
                [](ArkUI_DragAndDropInfo *dragAndDropInfo, void *userData) -> void {
                    ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr;
                    OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI);
                    ArkUI_DragStatus status = OH_ArkUI_DragAndDropInfo_GetDragStatus(dragAndDropInfo);
                    if (status == ARKUI_DRAG_STATUS_STARTED) {
                        OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "dragTest",
                                     "dragTest ArkUI_DRAG_STATUS_STARTED");
                        logstr = "dragTest: ArkUI_DRAG_STATUS_STARTED";
                        ArkUI_AttributeItem dragTextItem = {.string = logstr.c_str()};
                        nodeAPI->setAttribute(textLog, NODE_TEXT_CONTENT, &dragTextItem);
                    } else if (status == ARKUI_DRAG_STATUS_ENDED) {
                        OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "dragTest",
                                     "dragTest ArkUI_DRAG_STATUS_ENDED");
                        logstr = "dragTest: ArkUI_DRAG_STATUS_ENDED";
                        ArkUI_AttributeItem dragTextItem = {.string = logstr.c_str()};
                        nodeAPI->setAttribute(textLog, NODE_TEXT_CONTENT, &dragTextItem);
                    }
                }
            );
            OH_ArkUI_StartDrag(btDragAction);
            OH_ArkUI_DragAction_Dispose(btDragAction);
        }
        if (TEST_NUM == 50) {
            auto btDragAction = OH_ArkUI_CreateDragActionWithNode(node);
            auto dragPreviewOption = OH_ArkUI_CreateDragPreviewOption();
            OH_ArkUI_DragPreviewOption_SetDefaultShadowEnabled(dragPreviewOption, false);
            OH_ArkUI_DragPreviewOption_SetDefaultRadiusEnabled(dragPreviewOption, false);
            OH_ArkUI_DragPreviewOption_SetNumberBadgeEnabled(dragPreviewOption, false);
            OH_ArkUI_DragPreviewOption_SetBadgeNumber(dragPreviewOption, 5);
            OH_ArkUI_DragAction_SetDragPreviewOption(btDragAction, dragPreviewOption);
            OH_ArkUI_DragAction_SetPointerId(btDragAction, 1);
            OH_ArkUI_StartDrag(btDragAction);
            OH_ArkUI_DragAction_Dispose(btDragAction);
        }
        if (TEST_NUM == 60) {
            auto btDragAction = OH_ArkUI_CreateDragActionWithNode(node);
            OH_ArkUI_StartDrag(btDragAction);
            OH_ArkUI_DragAction_Dispose(btDragAction);
        }
        if (TEST_NUM == 100) {
            auto btDragAction = OH_ArkUI_CreateDragActionWithNode(node);
            // 设置pixelMap
            OH_ArkUI_DragAction_SetPixelMaps(btDragAction, pixelVector.data(), pixelVector.size());
            auto dragPreviewOption = OH_ArkUI_CreateDragPreviewOption();
            OH_ArkUI_DragPreviewOption_SetScaleMode(dragPreviewOption, ARKUI_DRAG_PREVIEW_SCALE_AUTO);
            OH_ArkUI_DragPreviewOption_SetNumberBadgeEnabled(dragPreviewOption, true);
            OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CapiDragDragaction", "OnEventReceive index = %{public}d", indexC);
            OH_ArkUI_DragPreviewOption_SetBadgeNumber(dragPreviewOption, forcedNumber[indexC]);
            if (indexC++ >= 6){
                indexC = 0;
            }
            OH_ArkUI_DragAction_SetDragPreviewOption(btDragAction, dragPreviewOption);
            OH_ArkUI_StartDrag(btDragAction);
            OH_ArkUI_DragAction_Dispose(btDragAction);
        }
        if (TEST_NUM == 110) {
            auto btDragAction = OH_ArkUI_CreateDragActionWithNode(node);
            // 设置pixelMap
            OH_ArkUI_DragAction_SetPixelMaps(btDragAction, pixelVector.data(), pixelVector.size());
            OH_ArkUI_StartDrag(btDragAction);
            OH_ArkUI_DragAction_Dispose(btDragAction);
        }
        if (TEST_NUM == 120) {
            auto btDragAction = OH_ArkUI_CreateDragActionWithNode(node);
            // 设置pixelMap
            OH_ArkUI_DragAction_SetPixelMaps(btDragAction, pixelVector.data(), pixelVector.size());

            auto returnValue = OH_ArkUI_DragAction_RegisterStatusListener(btDragAction, nullptr,
                [](ArkUI_DragAndDropInfo *dragAndDropInfo, void *userData) -> void {});
            OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CapiDragDragaction", "OnEventReceive returnValue = %{public}d", returnValue);
            logstr = "returnValue = ";
            logstr += std::to_string(returnValue);
            ArkUI_AttributeItem dragTextItem = {.string = logstr.c_str()};
            nodeAPI->setAttribute(textLog, NODE_TEXT_CONTENT, &dragTextItem);
            OH_ArkUI_StartDrag(btDragAction);
            OH_ArkUI_DragAction_Dispose(btDragAction);
        }
        if (TEST_NUM == 130) {
            auto btDragAction = OH_ArkUI_CreateDragActionWithNode(node);
            // 设置pixelMap
            OH_ArkUI_DragAction_SetPixelMaps(btDragAction, pixelVector.data(), pixelVector.size());
            OH_ArkUI_DragAction_RegisterStatusListener(btDragAction, nullptr,
                [](ArkUI_DragAndDropInfo *dragAndDropInfo, void *userData) -> void {
                    ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr;
                    OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI);
                    ArkUI_DragStatus status = OH_ArkUI_DragAndDropInfo_GetDragStatus(dragAndDropInfo);
                    if (status == ARKUI_DRAG_STATUS_STARTED) {
                        OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "dragTest",
                                     "dragTest ArkUI_DRAG_STATUS_STARTED");
                        logstr = "dragTest: ArkUI_DRAG_STATUS_STARTED";
                        ArkUI_AttributeItem dragTextItem = {.string = logstr.c_str()};
                        nodeAPI->setAttribute(textLog, NODE_TEXT_CONTENT, &dragTextItem);
                    } else if (status == ARKUI_DRAG_STATUS_ENDED) {
                        OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "dragTest",
                                     "dragTest ArkUI_DRAG_STATUS_ENDED");
                        logstr = "dragTest: ArkUI_DRAG_STATUS_ENDED";
                        ArkUI_AttributeItem dragTextItem = {.string = logstr.c_str()};
                        nodeAPI->setAttribute(textLog, NODE_TEXT_CONTENT, &dragTextItem);
                    }
                }
            );
            OH_ArkUI_StartDrag(btDragAction);
            OH_ArkUI_DragAction_Dispose(btDragAction);
        }
        if (TEST_NUM == 140) {
            auto btDragAction = OH_ArkUI_CreateDragActionWithNode(node);
            // 设置pixelMap
            OH_ArkUI_DragAction_SetPixelMaps(btDragAction, pixelVector.data(), pixelVector.size());
            if (targetId == ON_DROP) {
                OH_ArkUI_DragAction_RegisterStatusListener(btDragAction, nullptr,
                    [](ArkUI_DragAndDropInfo *dragAndDropInfo, void *userData) -> void {
                        auto dragEvent = OH_ArkUI_DragAndDropInfo_GetDragEvent(dragAndDropInfo);
                        ArkUI_DragResult dragResult;
                        OH_ArkUI_DragEvent_GetDragResult(dragEvent, &dragResult);
                        ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr;
                        OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI);
                        if (dragResult == ARKUI_DRAG_RESULT_SUCCESSFUL) {
                            OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "dragTest",
                                         "OH_ArkUI_DragEvent_GetDragResult ARKUI_DRAG_RESULT_SUCCESSFUL");
                            logstr = "log: ARKUI_DRAG_RESULT_SUCCESSFUL";
                            ArkUI_AttributeItem dragTextItem = {.string = logstr.c_str()};
                            nodeAPI->setAttribute(textLog, NODE_TEXT_CONTENT, &dragTextItem);
                        } else if (dragResult == ARKUI_DRAG_RESULT_FAILED) {
                            OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "dragTest",
                                         "OH_ArkUI_DragEvent_GetDragResult ARKUI_DRAG_RESULT_FAILED");
                            logstr = "log: ARKUI_DRAG_RESULT_FAILED";
                            ArkUI_AttributeItem dragTextItem = {.string = logstr.c_str()};
                            nodeAPI->setAttribute(textLog, NODE_TEXT_CONTENT, &dragTextItem);
                        }
                    }
                );
            }
            OH_ArkUI_StartDrag(btDragAction);
            OH_ArkUI_DragAction_Dispose(btDragAction);
        }
    }
}
}

void CapiDragDragaction::CreateCapiDragDragaction0010(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    // 拖拽节点
    auto button = createDragChildNode(nodeAPI, ARKUI_NODE_BUTTON, true, "DRAG");
    nodeAPI->registerNodeEvent(button, NODE_ON_TOUCH_INTERCEPT, ON_TOUCH_INTERCEPT, nullptr);
    nodeAPI->registerNodeEvent(button, NODE_ON_DRAG_START, ON_DRAG_START, nullptr);
    // 拖拽区域
    auto row = createDragAreaNode(nodeAPI, ARKUI_NODE_ROW);
    SetNodeWidthAndHeight(nodeAPI, row, 300, 200);
    // log
    DragDragaction::returnLog = nodeAPI->createNode(ARKUI_NODE_TEXT);

    ArkUI_AttributeItem buttonId = {.string = "DragDragaction0010_button"};
    nodeAPI->setAttribute(button, NODE_ID, &buttonId);
    ArkUI_AttributeItem rowId = {.string = "DragDragaction0010_row"};
    nodeAPI->setAttribute(row, NODE_ID, &rowId);

    OH_ArkUI_AllowNodeAllDropDataTypes(row);
    DragDragaction::TEST_NUM = 10;
    nodeAPI->registerNodeEventReceiver(&DragDragaction::OnEventReceive);

    nodeAPI->addChild(rootNode, button);
    nodeAPI->addChild(rootNode, row);
    nodeAPI->addChild(rootNode, DragDragaction::returnLog);
}

void CapiDragDragaction::CreateCapiDragDragaction0020(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    // 拖拽节点
    auto button = createDragChildNode(nodeAPI, ARKUI_NODE_BUTTON, true, "DRAG");
    nodeAPI->registerNodeEvent(button, NODE_ON_TOUCH_INTERCEPT, ON_TOUCH_INTERCEPT, nullptr);
    nodeAPI->registerNodeEvent(button, NODE_ON_DRAG_START, ON_DRAG_START, nullptr);
    // 拖拽区域
    auto row = createDragAreaNode(nodeAPI, ARKUI_NODE_ROW);
    SetNodeWidthAndHeight(nodeAPI, row, 300, 200);
    // log
    DragDragaction::returnLog = nodeAPI->createNode(ARKUI_NODE_TEXT);

    ArkUI_AttributeItem buttonId = {.string = "DragDragaction0020_button"};
    nodeAPI->setAttribute(button, NODE_ID, &buttonId);
    ArkUI_AttributeItem rowId = {.string = "DragDragaction0020_row"};
    nodeAPI->setAttribute(row, NODE_ID, &rowId);

    OH_ArkUI_AllowNodeAllDropDataTypes(row);
    DragDragaction::TEST_NUM = 20;
    nodeAPI->registerNodeEventReceiver(&DragDragaction::OnEventReceive);

    nodeAPI->addChild(rootNode, button);
    nodeAPI->addChild(rootNode, row);
    nodeAPI->addChild(rootNode, DragDragaction::returnLog);
}

void CapiDragDragaction::CreateCapiDragDragaction0030(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    // 拖拽节点
    auto button = createDragChildNode(nodeAPI, ARKUI_NODE_BUTTON, true, "DRAG");
    nodeAPI->registerNodeEvent(button, NODE_ON_TOUCH_INTERCEPT, ON_TOUCH_INTERCEPT, nullptr);
    nodeAPI->registerNodeEvent(button, NODE_ON_DRAG_START, ON_DRAG_START, nullptr);
    // 拖拽区域
    auto row = createDragAreaNode(nodeAPI, ARKUI_NODE_ROW);
    SetNodeWidthAndHeight(nodeAPI, row, 300, 200);
    // log
    DragDragaction::returnLog = nodeAPI->createNode(ARKUI_NODE_TEXT);

    ArkUI_AttributeItem buttonId = {.string = "DragDragaction0030_button"};
    nodeAPI->setAttribute(button, NODE_ID, &buttonId);
    ArkUI_AttributeItem rowId = {.string = "DragDragaction0030_row"};
    nodeAPI->setAttribute(row, NODE_ID, &rowId);

    OH_ArkUI_AllowNodeAllDropDataTypes(row);
    DragDragaction::TEST_NUM = 30;
    nodeAPI->registerNodeEventReceiver(&DragDragaction::OnEventReceive);

    nodeAPI->addChild(rootNode, button);
    nodeAPI->addChild(rootNode, row);
    nodeAPI->addChild(rootNode, DragDragaction::returnLog);
}

void CapiDragDragaction::CreateCapiDragDragaction0040(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    // 拖拽节点
    auto button = createDragChildNode(nodeAPI, ARKUI_NODE_BUTTON, true, "DRAG");
    nodeAPI->registerNodeEvent(button, NODE_ON_TOUCH_INTERCEPT, ON_TOUCH_INTERCEPT, nullptr);
    nodeAPI->registerNodeEvent(button, NODE_ON_DRAG_START, ON_DRAG_START, nullptr);
    // 拖拽区域
    auto column1 = createDragAreaNode(nodeAPI, ARKUI_NODE_COLUMN, "area1");
    auto column2 = createDragAreaNode(nodeAPI, ARKUI_NODE_COLUMN, "area2");
    auto column3 = createDragAreaNode(nodeAPI, ARKUI_NODE_COLUMN, "area3");
    // log
    DragDragaction::textLog = nodeAPI->createNode(ARKUI_NODE_TEXT);
    DragDragaction::returnLog = nodeAPI->createNode(ARKUI_NODE_TEXT);
    SetNodeWidthAndHeight(nodeAPI, column1, 300, 100);
    SetNodeWidthAndHeight(nodeAPI, column2, 300, 100);
    SetNodeWidthAndHeight(nodeAPI, column3, 300, 100);

    ArkUI_AttributeItem buttonId = {.string = "DragDragaction0040_button"};
    nodeAPI->setAttribute(button, NODE_ID, &buttonId);
    ArkUI_AttributeItem columnId2 = {.string = "DragDragaction0040_column2"};
    nodeAPI->setAttribute(column2, NODE_ID, &columnId2);
    ArkUI_AttributeItem columnId3 = {.string = "DragDragaction0040_column3"};
    nodeAPI->setAttribute(column3, NODE_ID, &columnId3);

    OH_ArkUI_DisallowNodeAnyDropDataTypes(column1);
    OH_ArkUI_AllowNodeAllDropDataTypes(column2);
    OH_ArkUI_AllowNodeAllDropDataTypes(column3);
    DragDragaction::TEST_NUM = 40;
    nodeAPI->registerNodeEventReceiver(&DragDragaction::OnEventReceive);

    nodeAPI->addChild(rootNode, button);
    nodeAPI->addChild(rootNode, column1);
    nodeAPI->addChild(rootNode, column2);
    nodeAPI->addChild(rootNode, column3);
    nodeAPI->addChild(rootNode, DragDragaction::returnLog);
    nodeAPI->addChild(rootNode, DragDragaction::textLog);
}

void CapiDragDragaction::CreateCapiDragDragaction0050(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    // 拖拽节点
    auto button = createDragChildNode(nodeAPI, ARKUI_NODE_BUTTON, true, "DRAG");
    nodeAPI->registerNodeEvent(button, NODE_ON_TOUCH_INTERCEPT, ON_TOUCH_INTERCEPT, nullptr);
    nodeAPI->registerNodeEvent(button, NODE_ON_DRAG_START, ON_DRAG_START, nullptr);
    // 拖拽区域
    auto column1 = createDragAreaNode(nodeAPI, ARKUI_NODE_COLUMN, "区域1");
    auto column2 = createDragAreaNode(nodeAPI, ARKUI_NODE_COLUMN, "区域2");
    auto column3 = createDragAreaNode(nodeAPI, ARKUI_NODE_COLUMN, "区域3");

    nodeAPI->registerNodeEvent(column1, NODE_ON_DRAG_MOVE, 1, nullptr);
    nodeAPI->registerNodeEvent(column3, NODE_ON_DRAG_MOVE, 1, nullptr);
    SetNodeWidthAndHeight(nodeAPI, column1, 300, 100);
    SetNodeWidthAndHeight(nodeAPI, column2, 300, 100);
    SetNodeWidthAndHeight(nodeAPI, column3, 300, 100);

    ArkUI_AttributeItem buttonId = {.string = "DragDragaction0050_button"};
    nodeAPI->setAttribute(button, NODE_ID, &buttonId);
    ArkUI_AttributeItem columnId1 = {.string = "DragDragaction0050_column1"};
    nodeAPI->setAttribute(column1, NODE_ID, &columnId1);
    ArkUI_AttributeItem columnId3 = {.string = "DragDragaction0050_column3"};
    nodeAPI->setAttribute(column3, NODE_ID, &columnId3);

    OH_ArkUI_DisallowNodeAnyDropDataTypes(column1);
    OH_ArkUI_AllowNodeAllDropDataTypes(column3);
    DragDragaction::TEST_NUM = 50;
    nodeAPI->registerNodeEventReceiver(&DragDragaction::OnEventReceive);

    nodeAPI->addChild(rootNode, button);
    nodeAPI->addChild(rootNode, column1);
    nodeAPI->addChild(rootNode, column2);
    nodeAPI->addChild(rootNode, column3);
}

void CapiDragDragaction::CreateCapiDragDragaction0060(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    // 拖拽节点
    auto button = createDragChildNode(nodeAPI, ARKUI_NODE_BUTTON, true, "DRAG3");
    // 拖拽区域
    auto row = createDragAreaNode(nodeAPI, ARKUI_NODE_ROW);
    SetNodeWidthAndHeight(nodeAPI, row, 300, 200);

    ArkUI_AttributeItem buttonId = {.string = "DragDragaction0060_button"};
    nodeAPI->setAttribute(button, NODE_ID, &buttonId);
    ArkUI_AttributeItem rowId = {.string = "DragDragaction0060_row"};
    nodeAPI->setAttribute(row, NODE_ID, &rowId);

    OH_ArkUI_AllowNodeAllDropDataTypes(row);
    DragDragaction::TEST_NUM = 60;
    nodeAPI->registerNodeEventReceiver(&DragDragaction::OnEventReceive);

    nodeAPI->addChild(rootNode, button);
    nodeAPI->addChild(rootNode, row);
}

void CapiDragDragaction::CreateCapiDragDragaction0070(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    // 拖拽节点
    auto button = createDragChildNode(nodeAPI, ARKUI_NODE_BUTTON, true, "DRAG");
    nodeAPI->registerNodeEvent(button, NODE_ON_TOUCH_INTERCEPT, ON_TOUCH_INTERCEPT, nullptr);
    nodeAPI->registerNodeEvent(button, NODE_ON_DRAG_START, ON_DRAG_START, nullptr);
    // 拖拽区域
    auto row = createDragAreaNode(nodeAPI, ARKUI_NODE_ROW);
    SetNodeWidthAndHeight(nodeAPI, row, 300, 200);

    ArkUI_AttributeItem buttonId = {.string = "DragDragaction0070_button"};
    nodeAPI->setAttribute(button, NODE_ID, &buttonId);
    ArkUI_AttributeItem rowId = {.string = "DragDragaction0070_row"};
    nodeAPI->setAttribute(row, NODE_ID, &rowId);

    OH_ArkUI_AllowNodeAllDropDataTypes(row);
    nodeAPI->registerNodeEventReceiver(&DragDragaction::OnEventReceive);

    nodeAPI->addChild(rootNode, button);
    nodeAPI->addChild(rootNode, row);
}

namespace DragDragaction0080 {
static void OnEventReceive(ArkUI_NodeEvent *event)
{
    OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "cch= CapiDragDragaction", "OnEventReceive");
    if (event == nullptr) {
        OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CapiDragDragaction", "OnEventReceive: event is null");
        return;
    }
	auto targetId = OH_ArkUI_NodeEvent_GetTargetId(event);
    OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "cch= CapiDragDragaction", "OnEventReceive: targetId is %{public}d", targetId);
	ArkUI_NodeHandle node = OH_ArkUI_NodeEvent_GetNodeHandle(event);

    if (targetId == ON_TOUCH_INTERCEPT) {
        OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "cch= CapiDragDragaction", "OnEventReceive ON_TOUCH_INTERCEPT");
        auto action = OH_ArkUI_CreateDragActionWithNode(node);
        auto *previewOptions = OH_ArkUI_CreateDragPreviewOption();
        OH_ArkUI_DragAction_SetDragPreviewOption(action, previewOptions);
        OH_ArkUI_StartDrag(action);
        OH_ArkUI_DragAction_Dispose(action);
    }
}
}
void CapiDragDragaction::CreateCapiDragDragaction0080(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    // 拖拽节点
    auto button = createDragChildNode(nodeAPI, ARKUI_NODE_BUTTON, true, "DRAG");
    nodeAPI->registerNodeEvent(button, NODE_ON_TOUCH_INTERCEPT, ON_TOUCH_INTERCEPT, nullptr);
    nodeAPI->registerNodeEvent(button, NODE_ON_DRAG_START, ON_DRAG_START, nullptr);
    // 拖拽区域
    auto dragArea = createDragAreaNode(nodeAPI, ARKUI_NODE_COLUMN, "拖拽区域");
    SetNodeWidthAndHeight(nodeAPI, dragArea, 300, 200);

    ArkUI_AttributeItem buttonId = {.string = "DragDragaction0080_button"};
    nodeAPI->setAttribute(button, NODE_ID, &buttonId);
    ArkUI_AttributeItem rowId = {.string = "DragDragaction0080_row"};
    nodeAPI->setAttribute(dragArea, NODE_ID, &rowId);

    OH_ArkUI_AllowNodeAllDropDataTypes(dragArea);
    nodeAPI->registerNodeEventReceiver(&DragDragaction0080::OnEventReceive);

    nodeAPI->addChild(rootNode, button);
    nodeAPI->addChild(rootNode, dragArea);
}

void CapiDragDragaction::CreateCapiDragDragaction0090(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    // 拖拽节点
    auto button = createDragChildNode(nodeAPI, ARKUI_NODE_BUTTON, true, "DRAG");
    nodeAPI->registerNodeEvent(button, NODE_ON_TOUCH_INTERCEPT, ON_TOUCH_INTERCEPT, nullptr);
    nodeAPI->registerNodeEvent(button, NODE_ON_DRAG_START, ON_DRAG_START, nullptr);
    // 拖拽区域
    auto column1 = createDragAreaNode(nodeAPI, ARKUI_NODE_COLUMN, "区域1");
    auto column2 = createDragAreaNode(nodeAPI, ARKUI_NODE_COLUMN, "区域2");
    auto column3 = createDragAreaNode(nodeAPI, ARKUI_NODE_COLUMN, "区域3");

    nodeAPI->registerNodeEvent(column3, NODE_ON_DRAG_MOVE, 1, nullptr);
    SetNodeWidthAndHeight(nodeAPI, column1, 300, 100);
    SetNodeWidthAndHeight(nodeAPI, column2, 300, 100);
    SetNodeWidthAndHeight(nodeAPI, column3, 300, 100);

    ArkUI_AttributeItem buttonId = {.string = "DragDragaction0090_button"};
    nodeAPI->setAttribute(button, NODE_ID, &buttonId);
    ArkUI_AttributeItem columnId1 = {.string = "DragDragaction0090_column1"};
    nodeAPI->setAttribute(column1, NODE_ID, &columnId1);
    ArkUI_AttributeItem columnId3 = {.string = "DragDragaction0090_column3"};
    nodeAPI->setAttribute(column3, NODE_ID, &columnId3);

    OH_ArkUI_DisallowNodeAnyDropDataTypes(column1);
    OH_ArkUI_AllowNodeAllDropDataTypes(column3);
    nodeAPI->registerNodeEventReceiver(&DragDragaction0080::OnEventReceive);

    nodeAPI->addChild(rootNode, button);
    nodeAPI->addChild(rootNode, column1);
    nodeAPI->addChild(rootNode, column2);
    nodeAPI->addChild(rootNode, column3);
}

void CapiDragDragaction::CreateCapiDragDragaction0100(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    // 拖拽节点
    auto button = createDragChildNode(nodeAPI, ARKUI_NODE_BUTTON, true, "DRAG");
    nodeAPI->registerNodeEvent(button, NODE_ON_TOUCH_INTERCEPT, ON_TOUCH_INTERCEPT, nullptr);
    nodeAPI->registerNodeEvent(button, NODE_ON_DRAG_START, ON_DRAG_START, nullptr);
    // 拖拽区域
    auto row = createDragAreaNode(nodeAPI, ARKUI_NODE_ROW);
    SetNodeWidthAndHeight(nodeAPI, row, 300, 200);

    ArkUI_AttributeItem buttonId = {.string = "DragDragaction0100_button"};
    nodeAPI->setAttribute(button, NODE_ID, &buttonId);
    ArkUI_AttributeItem rowId = {.string = "DragDragaction0100_row"};
    nodeAPI->setAttribute(row, NODE_ID, &rowId);

    OH_ArkUI_AllowNodeAllDropDataTypes(row);
    DragDragaction::TEST_NUM = 100;
    nodeAPI->registerNodeEventReceiver(&DragDragaction::OnEventReceive);

    nodeAPI->addChild(rootNode, button);
    nodeAPI->addChild(rootNode, row);
}

void CapiDragDragaction::CreateCapiDragDragaction0110(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    // 拖拽节点
    auto button = createDragChildNode(nodeAPI, ARKUI_NODE_BUTTON, true, "DRAG");
    nodeAPI->registerNodeEvent(button, NODE_ON_TOUCH_INTERCEPT, ON_TOUCH_INTERCEPT, nullptr);
    nodeAPI->registerNodeEvent(button, NODE_ON_DRAG_START, ON_DRAG_START, nullptr);
    // 拖拽区域
    auto row = createDragAreaNode(nodeAPI, ARKUI_NODE_ROW, "区域3");
    SetNodeWidthAndHeight(nodeAPI, row, 300, 200);

    ArkUI_AttributeItem buttonId = {.string = "DragDragaction0110_button"};
    nodeAPI->setAttribute(button, NODE_ID, &buttonId);
    ArkUI_AttributeItem rowId = {.string = "DragDragaction0110_row"};
    nodeAPI->setAttribute(row, NODE_ID, &rowId);

    OH_ArkUI_AllowNodeAllDropDataTypes(row);
    DragDragaction::TEST_NUM = 110;
    nodeAPI->registerNodeEventReceiver(&DragDragaction::OnEventReceive);

    nodeAPI->addChild(rootNode, button);
    nodeAPI->addChild(rootNode, row);
}

void CapiDragDragaction::CreateCapiDragDragaction0120(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    // 拖拽节点
    auto button = createDragChildNode(nodeAPI, ARKUI_NODE_BUTTON, true, "DRAG");
    nodeAPI->registerNodeEvent(button, NODE_ON_TOUCH_INTERCEPT, ON_TOUCH_INTERCEPT, nullptr);
    nodeAPI->registerNodeEvent(button, NODE_ON_DRAG_START, ON_DRAG_START, nullptr);
    // 拖拽区域
    auto row = createDragAreaNode(nodeAPI, ARKUI_NODE_ROW, "区域3");
    SetNodeWidthAndHeight(nodeAPI, row, 300, 200);
    // log
    DragDragaction::textLog = nodeAPI->createNode(ARKUI_NODE_TEXT);

    ArkUI_AttributeItem buttonId = {.string = "DragDragaction0120_button"};
    nodeAPI->setAttribute(button, NODE_ID, &buttonId);
    ArkUI_AttributeItem rowId = {.string = "DragDragaction0120_row"};
    nodeAPI->setAttribute(row, NODE_ID, &rowId);

    OH_ArkUI_AllowNodeAllDropDataTypes(row);
    DragDragaction::TEST_NUM = 120;
    nodeAPI->registerNodeEventReceiver(&DragDragaction::OnEventReceive);

    nodeAPI->addChild(rootNode, button);
    nodeAPI->addChild(rootNode, row);
    nodeAPI->addChild(rootNode, DragDragaction::textLog);
}

void CapiDragDragaction::CreateCapiDragDragaction0130(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    // 拖拽节点
    auto button = createDragChildNode(nodeAPI, ARKUI_NODE_BUTTON, true, "DRAG");
    nodeAPI->registerNodeEvent(button, NODE_ON_TOUCH_INTERCEPT, ON_TOUCH_INTERCEPT, nullptr);
    nodeAPI->registerNodeEvent(button, NODE_ON_DRAG_START, ON_DRAG_START, nullptr);
    // 拖拽区域
    auto row = createDragAreaNode(nodeAPI, ARKUI_NODE_ROW, "区域3");
    SetNodeWidthAndHeight(nodeAPI, row, 300, 200);
    // log
    DragDragaction::textLog = nodeAPI->createNode(ARKUI_NODE_TEXT);

    ArkUI_AttributeItem buttonId = {.string = "DragDragaction0130_button"};
    nodeAPI->setAttribute(button, NODE_ID, &buttonId);
    ArkUI_AttributeItem rowId = {.string = "DragDragaction0130_row"};
    nodeAPI->setAttribute(row, NODE_ID, &rowId);

    OH_ArkUI_AllowNodeAllDropDataTypes(row);
    DragDragaction::TEST_NUM = 130;
    nodeAPI->registerNodeEventReceiver(&DragDragaction::OnEventReceive);

    nodeAPI->addChild(rootNode, button);
    nodeAPI->addChild(rootNode, row);
    nodeAPI->addChild(rootNode, DragDragaction::textLog);
}

void CapiDragDragaction::CreateCapiDragDragaction0140(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    // 拖拽节点
    auto button = createDragChildNode(nodeAPI, ARKUI_NODE_BUTTON, true, "DRAG");
    nodeAPI->registerNodeEvent(button, NODE_ON_TOUCH_INTERCEPT, ON_TOUCH_INTERCEPT, nullptr);
    nodeAPI->registerNodeEvent(button, NODE_ON_DRAG_START, ON_DRAG_START, nullptr);
    // 拖拽区域
    auto row = createDragAreaNode(nodeAPI, ARKUI_NODE_ROW, "区域3");
    SetNodeWidthAndHeight(nodeAPI, row, 300, 200);
    nodeAPI->registerNodeEvent(row, NODE_ON_DROP, ON_DROP, nullptr);
    nodeAPI->registerNodeEvent(rootNode, NODE_ON_DROP, ON_DROP, nullptr);
    // log
    DragDragaction::textLog = nodeAPI->createNode(ARKUI_NODE_TEXT);

    ArkUI_AttributeItem buttonId = {.string = "DragDragaction0140_button"};
    nodeAPI->setAttribute(button, NODE_ID, &buttonId);
    ArkUI_AttributeItem rowId = {.string = "DragDragaction0140_row"};
    nodeAPI->setAttribute(row, NODE_ID, &rowId);

    OH_ArkUI_AllowNodeAllDropDataTypes(row);
    OH_ArkUI_DisallowNodeAnyDropDataTypes(rootNode);
    DragDragaction::TEST_NUM = 140;
    nodeAPI->registerNodeEventReceiver(&DragDragaction::OnEventReceive);

    nodeAPI->addChild(rootNode, button);
    nodeAPI->addChild(rootNode, row);
    nodeAPI->addChild(rootNode, DragDragaction::textLog);
}

void CapiDragDragaction::CreateCapiDragDragaction0150(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    // 拖拽节点
    auto button = createDragChildNode(nodeAPI, ARKUI_NODE_BUTTON, false, "DRAG");
    // 拖拽区域
    auto row = createDragAreaNode(nodeAPI, ARKUI_NODE_ROW, "区域3");
    SetNodeWidthAndHeight(nodeAPI, row, 300, 200);
    // log
    auto textLog = nodeAPI->createNode(ARKUI_NODE_TEXT);

    auto pixelVector = createPixelmap();
    std::stringstream ss;

    auto dragAction = OH_ArkUI_CreateDragActionWithNode(nullptr);
    if (dragAction == nullptr) {
        ss << "log: \nOH_ArkUI_CreateDragActionWithNode = " << "(null)";
    } else {
        ss << "log: \nOH_ArkUI_CreateDragActionWithNode = " << std::to_string(reinterpret_cast<uintptr_t>(dragAction));
    }
    auto ret = OH_ArkUI_DragAction_SetPixelMaps(dragAction, pixelVector.data(), pixelVector.size());
    ss << "\nOH_ArkUI_DragAction_SetPixelMaps = " << std::to_string(ret);
    ret = OH_ArkUI_DragAction_SetPointerId(dragAction, 0);
    ss << "\nOH_ArkUI_DragAction_SetPointerId = " << std::to_string(ret);
    ret = OH_ArkUI_DragAction_SetTouchPointX(dragAction, 0);
    ss << "\nOH_ArkUI_DragAction_SetTouchPointX = " << std::to_string(ret);
    ret = OH_ArkUI_DragAction_SetTouchPointY(dragAction, 0);
    ss << "\nOH_ArkUI_DragAction_SetTouchPointY = " << std::to_string(ret);
    auto dragPreviewOption = OH_ArkUI_CreateDragPreviewOption();
    ret = OH_ArkUI_DragAction_SetDragPreviewOption(dragAction, dragPreviewOption);
    ss << "\nOH_ArkUI_DragAction_SetDragPreviewOption = " << std::to_string(ret);
    ret = OH_ArkUI_DragAction_RegisterStatusListener(dragAction, nullptr,
                    [](ArkUI_DragAndDropInfo *dragAndDropInfo, void *userData) -> void {});
    ss << "\nOH_ArkUI_DragAction_RegisterStatusListener = " << std::to_string(ret);

    std::string logstr = ss.str();
    ArkUI_AttributeItem dragTextItem = {.string = logstr.c_str()};
    nodeAPI->setAttribute(textLog, NODE_TEXT_CONTENT, &dragTextItem);

    nodeAPI->addChild(rootNode, button);
    nodeAPI->addChild(rootNode, row);
    nodeAPI->addChild(rootNode, textLog);
}
} // namespace ArkUICApiDemo